package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.DmcPatrolReminderMapper;
import com.csun.cmny.provider.model.domain.DmcPatrolReminder;
import com.csun.cmny.provider.model.dto.patrol.PatrolReminderQueryDto;
import com.csun.cmny.provider.model.vo.patrol.PatrolReminderVo;
import com.csun.cmny.provider.service.DmcPatrolReminderService;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2021/7/22 9:47
 * @Description: 巡更提醒接口实现
 */
@Service
public class DmcPatrolReminderServiceImpl extends BaseService<DmcPatrolReminder>
        implements DmcPatrolReminderService {

    @Resource
    private DmcPatrolReminderMapper dmcPatrolReminderMapper;

    /**
     * 巡更提醒 - 分页查询
     *
     * @param patrolReminderQueryDto    the patrol reminder query dto
     *
     * @return  the patrol reminder vo list.
     */
    @Override
    public List<PatrolReminderVo> queryListWithPage(PatrolReminderQueryDto patrolReminderQueryDto) {

        PageHelper.startPage(patrolReminderQueryDto.getPageNum(), patrolReminderQueryDto.getPageSize());

        return dmcPatrolReminderMapper.queryListWithPage(patrolReminderQueryDto);
    }

    /**
     * 巡更提醒记录 - 待巡更
     *
     * @param date
     *
     * @return  the dmc patrol reminder
     */
    @Override
    public List<DmcPatrolReminder> queryWaitList(String date) {

        return dmcPatrolReminderMapper.queryWaitList(date);
    }

    /**
     * 更新巡更提醒 - 待巡更
     *
     * @param greatId   巡更棒ID
     * @param pointId   巡更点ID
     * @param patrolTime    巡更时间
     *
     * @return  the int.
     */
    @Override
    public Integer updateWait(Long greatId, Long pointId, String patrolTime) {

        return dmcPatrolReminderMapper.updateWait(greatId, pointId, patrolTime);
    }
    /*
    * 删除巡更提醒
    * */
    @Override
    public void deleteByPatrolId(Long deviceId) {
        dmcPatrolReminderMapper.deleteByPatrolId(deviceId);
    }

    @Override
    public void deleteByPointId(Long deviceId) {
        dmcPatrolReminderMapper.deleteByPointId(deviceId);
    }
}
